package com.atguigu.interceptor;

import com.atguigu.constant.UserConstant;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;


public class MySetmealInterceptor implements HandlerInterceptor {

    //拦截器 拦截预约设置
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        HttpSession session = request.getSession();
        Object attribute = session.getAttribute(UserConstant.LOGIN_USER);
        if (attribute!=null){
            return true;
        }
        return false;
    }
}
